
import {httpGet, httpPost, httpPut, httpDel} from '@/api';
import {checkUnique} from '@/api/system/commonFunc';

import { stringFormat, formatDate } from "@/utils/common";

import {downloadFile, commonDownload, downloadFileHidden }from '@/utils/downloadUtil'
import directive from '@/components/directive/'
import LamComponents from '@/components/lam'

import SvgIcon from '@/components/SvgIcon'// svg component
import Pagination from "@/components/Pagination";
import RightToolbar from "@/components/RightToolbar";
import SelectedInfo from "@/components/SelectedInfo";
import ContentSet from "@/components/ContentSet";
import LastUpdate from "@/components/Alert/LastUpdate";

import ConfigType from "@/views/system/dict/ConfigType";

export default {
  install(Vue) {

  	// 全局方法挂载
    Vue.prototype.$httpGet = httpGet
    Vue.prototype.$httpPost = httpPost
    Vue.prototype.$httpPut = httpPut
    Vue.prototype.$httpDel = httpDel
    Vue.prototype.$checkUnique = checkUnique

    Vue.prototype.$stringFormat = stringFormat
    Vue.prototype.$formatDate = formatDate
    // Vue.prototype.$handleTree = handleTree
    Vue.prototype.$downloadFile = downloadFile
    Vue.prototype.$commonDownload = commonDownload
    Vue.prototype.$downloadFileHidden = downloadFileHidden

    Vue.prototype.msgSuccess = function (msg) {
      this.$message({ showClose: true, message: msg, type: "success" });
    }
    Vue.prototype.msgError = function (msg) {
      this.$message({ showClose: true, message: msg, type: "error" });
    }
    Vue.prototype.msgWarn = function (msg) {
      this.$message({ showClose: true, message: msg, type: "warning" });
    }
    Vue.prototype.msgInfo = function (msg) {
      this.$message.info(msg);
    }

    //注册组件
    Vue.use(directive)
    Vue.component('svg-icon', SvgIcon)
    //自定义表格工具扩展
    Vue.component('Pagination', Pagination)
    Vue.component('RightToolbar', RightToolbar)
    Vue.component('SelectedInfo', SelectedInfo)
    Vue.component('ContentSet', ContentSet)
    Vue.component('LastUpdate', LastUpdate)
    Vue.component('ConfigType', ConfigType)

    Vue.use(LamComponents);
  }
}
